package juc;


import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Singleton {
  private volatile static Singleton singleton;

  public static Singleton getSingleton() {
    if (singleton == null){
      synchronized (Singleton.class){
        if (singleton == null) {
          singleton = new Singleton();
        }
      }
    }
    return singleton;
  }

  public static void main(String[] args) {
    DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
    LocalDateTime localDateTime = LocalDateTime.now();

    System.out.println(localDateTime);

    Integer var1 = 100;
    Integer var2 = 100;
    Integer var3 = 200;
    Integer var4 = 200;

    System.out.println(var1 == var2);
    System.out.println(var3 == var4);
  }
}
